1. Field of the Invention
The present invention relates to computer graphics, and more specifically relates to pixel sample manipulation.
2. Description of the Related Art
In a computer graphics display application, an image is generated by a display system and displayed on a screen. The image is composed by an array of individual picture-cells (xe2x80x9cpixelsxe2x80x9d). Pixels are the dots of color that define the image. Each of the pixels is defined by characteristics such as color and intensity. Traditionally, pixels are organized into a two-dimensional array or grid defined by raster lines. Each line is drawn by scan displaying the individual pixels along the line.
In practice, rather than defining the characteristics of each pixel, display systems define an image from a collection of primitive graphic shapes such as polygons. The polygons are numerically represented in terms of size, color, location and other characteristics, and the most common polygons used in rendering graphic images are triangles. To accomplish an image, the polygon representations are processed by an image generator producing pixel data signals through a process called polygon rendering. In effect, polygon rendering involves sampling a polygon to calculate how the polygon influences the pixels.
Display systems typically generate each pixel data signal by sampling several locations within the pixel of the polygon. This sampling technique is used to reduce undesirable visual artifacts in the displayed image. These visual artifacts, commonly referred to as aliasing, often appear as jagged lines at the polygon boundaries.
Some reduction of artifacts can be achieved with xe2x80x9cpolygon smoothing.xe2x80x9d Polygon smoothing is achieved by computing a coverage value for each pixel a polygon touches. The coverage value is proportional to the amount of the pixel covered by the polygon. The coverage value is used to modify alpha, which is used to blend to color of the polygon with contents of the frame buffer. In this technique, each fragment generated by rendering a triangle or other primitive is sampled at a higher rate. The total number of samples lit by the fragment modulates the intensity of the color for the fragment. However, this technique requires that the triangles in the scene be sorted by depth. The sorting is computational intensive.
The visual artifacts can also be reduced by a technique known as multisampling. Multisampling does not require sorting. Each pixel will have all its samples stored in the frame buffer. The standard Z buffering algorithm is applied to each sample.
Multisampling increases the sample rate for a given display resolution. The sample rate is arbitrary, but is usually 2, 4, 8 or 16 samples per pixel. The higher the sample rate, the less visual artifacts appear in the final image.
Cables are an example of objects that produce visual artifacts. If a cable is in the distance, then its width will be less than one pixel on the display. Without multisampling, the cable will appear as a dotted line, with each pixel that the cable passes through appearing as a dot. As the viewpoint of the cable changes, the dots will appear to move like raindrops.
With multisampling, the cable will light a small portion of every pixel it passes through. The intensity of each pixel will be proportional to the size of the cable. This reduces or eliminates the dotted line effect.
Multisampling is also useful to render transparent objects. Many scenes contain transparent objects such as windows. These objects affect the color of a pixel, but allow objects behind them to be visible. Opaque objects in front of a transparent object occlude the transparent object. If pixels are sampled at 16 samples per pixel, then a transparent object that transmits {fraction (15/16)}th of all the light passing through it can be rendered by discarding 15 of the 16 samples taken while rendering it. In other words, a transparent object transmitting {fraction (15/16)}th of all the light passing through it can be rendered by discarding 15 of the 16 samples. The transparent object is rendered by changing color for only one sample. However, picking the same sample in every pixel to keep may introduce visual artifacts that multisampling is supposed to remove.
Therefore, it is desirous to have a system and method for selecting samples of a pixel to prevent introduction of visual artifacts when multisampling is used to improve quality of rendered images. Accordingly, it is to the provision of such a system and method that the primary invention is primarily directed.
The present invention provides a system and method for drawing pictures involving transparent objects without need for time-consuming sorting of coverage triangles. The system and method represent an advantage because it eliminates computing intensive sorting.
Normally to draw a transparent object, one must draw objects behind the transparent object first, which means one must sort the triangles to determine what objects are behind the transparent object, then draw the transparent object and modify the color of the objects behind the transparent object Modification of color is thus based on the transparency of the object. After drawing the transparent object, one then draws objects in front of the transparent object, and this means more sorting of the triangles to determine what objects are in front of the transparent object.
The system and method eliminate triangle sorting, which is computationally intensive. When drawing a transparent object, the system uses X and Y addresses of a pixel to index into a shuffle table, and then using the output of the shuffle table to retrieve a transparency mask from a transparency table. The transparency mask is then ANDed with a coverage mask to generate a new coverage mask. The new coverage mask is then used to determine which samples to be dropped and which samples to be painted with the color of the transparent object. Because of X and Y addresses changes for each pixel, the transparency mask retrieved changes for each pixel, and thus creates a random coverage mask.
The present invention therefore represents an advantage in selecting samples of a pixel by preventing the introduction of visual artifacts when multisampling is used to improve quality of rendered images. The invention prevents unwanted visual artifacts through using a random pattern of kept or discarded samples between adjacent pixels. The present invention also allows finer levels of transparency through providing discreet levels of transparency over a specific region.
Other objects, features, and advantages of the present invention will become apparent after review of the hereinafter set forth Brief Description of the Drawings, Detailed Description of the Invention, and the Claims.